<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oClerkTable1554107622 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
		if(!Schema::hasTable($prefix . 'o2o_clerk')){
			Schema::create($prefix . 'o2o_clerk', function (Blueprint $table) {
				$table->increments('id');

				$table->string('clerk_no')->unique()->nullable(); //工号

				$table->string('name')->nullable();

				$table->string('nickname')->nullable();

				$table->string('avatar')->nullable();

				$table->string('email')->unique()->nullable();

				$table->string('mobile')->unique()->nullable();

				$table->tinyInteger('status')->default(1);

				$table->string('password')->nullable();

				$table->integer('is_clerk_owner')->default(0);   //是否是店长

				$table->integer('shop_id');   //所管理门店ID

				$table->rememberToken();

				$table->timestamps();

				$table->softDeletes();
			});
		}
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        Schema::drop($prefix . 'o2o_clerk');
    }
}
